package unipampa.extensions.games.pampaPife;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;

public class TratarDescartarCarta extends BaseClientRequestHandler{

	public void handleClientRequest(User usuario, ISFSObject params){
		PampaPifeExtension gameExt = (PampaPifeExtension) getParentExtension();
		Carta c = new Carta(params.getInt("valor"), params.getInt("naipe"), params.getInt("baralho"));
		
		gameExt.colocaNoDescarte(c);
		ISFSObject respObj = new SFSObject();
		respObj.putInt("t", gameExt.proximoJogador());
		respObj.putInt("valor",gameExt.cartaTopoDescarte.getValor());
		respObj.putInt("naipe",gameExt.cartaTopoDescarte.getNaipe());
		respObj.putInt("baralho",gameExt.cartaTopoDescarte.getBaralho());
		
		trace("Enviando atualizacao do descarte.");
		send("atualizaCartaDescarte", respObj, gameExt.getParentRoom().getUserList());
	}
}